//
//  GNRPeripheralManager.h
//  BlueToothDemo
//
//  Created by LvYuan on 2017/4/20.
//  Copyright © 2017年 UUPaotui. All rights reserved.
//

/***********

 这个类是将此app作为一个虚拟蓝牙外设
 
 ***********/

#import <Foundation/Foundation.h>
#import "GNRBLEHeader.h"

@interface GNRBLEPeripheralManager : NSObject

/**
 设备名字
 */
@property (nonatomic, strong) NSString * name;
@property (nonatomic, strong) NSString * identification;//用户唯一标识 电话
/**
 个人信息 包括昵称 积分等 以json形式传输 在open之前设置
 
 //可以自己拓展
 格式：{
        identification
        nickname:XXX
        head:url
        }
 */
@property (nonatomic, strong) NSDictionary * profileInfo;

//外设管理者
@property (nonatomic, strong) CBPeripheralManager * peripheralManger;
@property (nonatomic, strong) NSMutableArray <GNRCentral *>* centrals;//被连接的中心数组
+ (instancetype)manager;
- (BOOL)removeCen:(GNRCentral *)central;
//开启设备回调
- (void)openPeripheralSuccee:(GNRBLEOpenPeripheralSucceeBlock)succeeBlock
                       error:(GNRBLEOpenPeripheralErrorBlock)errorBlock;

//被订阅的回调
- (void)revProfileInfoBlock:(GNRBLERevProfileInfoBlock)revProfileInfoBlock
          didSubscribeBlock:(GNRBLEDidSubscribeBlock)subscribeBlock;

//被取消订阅的回调
- (void)didUnsubscribeBlock:(GNRBLEDidUnsubscribeBlock)unsubscribeBlock;

//开始发送通知
- (void)startSendForCentral:(GNRCentral *)central;

//拒绝订阅请求
- (BOOL)refuseSubscribeForCentral:(GNRCentral *)central;

//停止发送 通知
- (void)stopSendNotify:(GNRCentral *)central;

//开始广播
- (void)startAdvertising;

//停止广播
- (void)stopAdvertising;

@end
